﻿using Com.Enemy.EnemySystem.EnemyAI;
using Com.Enemy.EnemySystem.EnemyLifecycle;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.PlayerLoop;

public class PlayerBuff : BuffBase
{
    [SerializeField]
    protected int ID;

    protected PlayerBody playerBody;

    [SerializeField]
    protected PlayerData buffData;

    public PlayerBuff(string name, bool haveUI, string describe, bool limitTime_Is, float limitTime_S, BuffType bType, PlayerData playerData) : base(name, haveUI, describe, limitTime_Is, limitTime_S, bType)
    {
        this.buffData = playerData;
    }

    public void Start(PlayerBody playerBody)
    {
        this.playerBody = playerBody;
        ID = playerBody.ID;
        if (buffData != null)
        {
            playerBody.PlayerData.Plus(buffData);
        }
        OnStart();
    }

    public override void OnEnd()
    {
        if (playerBody != null)
        {
            playerBody.PlayerData.Minus(buffData);
        }
    }
}
